package com.bhkj.pdjhbgnewproject.core.notlogin;

import android.support.constraint.ConstraintLayout;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bhkj.pdjhbgnewproject.R;
import com.bhkj.pdjhbgnewproject.common.contanct.Contacts;
import com.bhkj.pdjhbgnewproject.core.main.MainActivity;
import com.bhkj.pdjhbgnewproject.core.service.ObtainPdInfoService;
import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.ObjectUtils;
import com.blankj.utilcode.util.SPUtils;
import com.blankj.utilcode.util.ServiceUtils;

public class NotLoginHandler {
    private INotLoginView iNotLoginView;
    private ConstraintLayout rootLayout;
    private TextView windowNumTv, deptNameTv, blnumTipTv, currentNumTv, waitNumTipTv;
    private ImageView iconIv;
    private int ICON_SIZE = 100;

    public NotLoginHandler(INotLoginView iNotLoginView) {
        this.iNotLoginView = iNotLoginView;
        ServiceUtils.startService(ObtainPdInfoService.class);
//        String endService = SPUtils.getInstance().getString(Contacts.PUSH_END_SERVICE);
//        if (ObjectUtils.isEmpty(endService)) {
//
//        }
        String loginInfo = SPUtils.getInstance().getString(Contacts.PARAM_LOGIN_INFO);
        if (ObjectUtils.isNotEmpty(loginInfo)) {
            ActivityUtils.startActivity(MainActivity.class);
            return;
        }
        if (iNotLoginView.getResources().getBoolean(R.bool.isYsd)) {
            return;
        }
        initView();
    }

    private void initView() {
        rootLayout = iNotLoginView.findViewById(R.id.rootView);
        iconIv = iNotLoginView.findViewById(R.id.iv_main_police_icon);
        windowNumTv = iNotLoginView.findViewById(R.id.tv_main_window_name);
        deptNameTv = iNotLoginView.findViewById(R.id.tv_main_dw);

        blnumTipTv = iNotLoginView.findViewById(R.id.tv_main_blnm);
        currentNumTv = iNotLoginView.findViewById(R.id.tv_main_current_num);
        waitNumTipTv = iNotLoginView.findViewById(R.id.tv_main_waitnum);
        hideTv();

        rootLayout.setBackgroundResource(R.mipmap.w_1);
//        obtainWindowShowInfo();
    }


    private void hideTv() {
        blnumTipTv.setVisibility(View.GONE);
        currentNumTv.setVisibility(View.GONE);
        waitNumTipTv.setVisibility(View.GONE);
    }


}
